<?
class ConverterException extends Exception {
	private $converter,$error,$arguments;
	public function __construct(Converter $converter,$error,$arguments=array()) {
		$this->converter= $converter;
		$this->error= $error;
		// always convert arguments to an array
		$this->arguments= (array)$arguments;
		$msg= $error.'('.print_r($this->arguments,true).')';

		parent::__construct($msg);
	}
	public function getErrorMessage() {
		array_push($this->arguments,null);
		return vsprintf($this->converter->getErrorMessage(),$this->arguments);
	}
	public function getConverter() {
		return $this->converter;
	}
	public function getError() {
		return $this->error;
	}
	public function getArguments() {
		return $this->arguments;
	}	
	public function __toString() {
		return $this->getErrorMessage();
	}	
}